package com.xxx.seckill.controller;


import com.xxx.seckill.pojo.TUser;
import com.xxx.seckill.rabbitmq.MQSender;
import com.xxx.seckill.vo.RespBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author XXX
 * @since 2023-01-04
 */
@Controller
@RequestMapping("/user")
public class TUserController {
    
    @Autowired
    private MQSender mqSender;

    /**
     * 测试发送rabbitmq的headers
     */
    @RequestMapping("/mq/headers02")
    @ResponseBody
    public void mqHeaders02(){
        mqSender.send06("hello,Headers02");
    }

    /**
     * 测试发送rabbitmq的headers
     */
    @RequestMapping("/mq/headers01")
    @ResponseBody
    public void mqHeaders01(){
        mqSender.send05("hello,Headers01");
    }

    /**
     * 测试发送rabbitmq的topic (被连个queue接收)
     */
    @RequestMapping("/mq/topic02")
    @ResponseBody
    public void mqTopic02(){
        mqSender.send04("hello,Green");
    }
    

    /**
     * 测试发送rabbitmq的topic (QUEUE01接收)
     */
    @RequestMapping("/mq/topic01")
    @ResponseBody
    public void mqTopic01(){
        mqSender.send03("hello,Red");
    }



    /**
     * 测试发送rabbitmq的direct green
     */
    @RequestMapping("/mq/direct02")
    @ResponseBody
    public void mqDirect02(){
        mqSender.send02("hello,Green");
    }

    /**
     * 测试发送rabbitmq的direct red
     */
    @RequestMapping("/mq/direct01")
    @ResponseBody
    public void mqDirect01(){
        mqSender.send01("hello,Red");
    }
    


    /**
     * 测试发送rabbitmq的交换机
     *
     */
    @RequestMapping("/mqExchange")
    @ResponseBody
    public void mqExchange(){
        mqSender.send1("hello= 欢迎来到mqExchange的世界");
    }


    /**
     * 测试发送rabbitmq
     * 
     */
    @RequestMapping("/mq")
    @ResponseBody
    public void mq(){
        mqSender.send("hello= 欢迎来到rabbitmq世界");
    }

   
    

    /**
     * 用户信息（测试）
     * @param user
     * @return
     */
    @RequestMapping("/info")
    @ResponseBody
    public RespBean info(TUser user){
        return RespBean.success(user);
    }
    
}
